package com.Reporte_Evolutivo;

import java.util.ArrayList;
import java.util.List;

import com.downloader.GestorTipoEvento;
import com.downloader.PicVidBean;
import com.reportes.R;
import com.Adapter.ImageAdapter_dinamico;
import com.BD.*;

import android.app.ActionBar;
import android.app.Activity;
import android.content.Intent;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.GridView;
import android.widget.Toast;
import android.widget.AdapterView.OnItemClickListener;

public class RE_2_Subtipo_Evento extends Activity {
	
	public String idTipo;
	public GridView gridviewSubTipos;
	//ArrayList<TablaSubtipo> tsb = new ArrayList();
	public BD_SQLite db = null;
	/**
	 * @see android.app.Activity#onCreate(Bundle)
	 */
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		idTipo= this.getIntent().getExtras().getString("idTipoEvento");
		super.onCreate(savedInstanceState);
		setContentView(R.layout.re_2_subtipo_evento);
		Resources res = getResources();
		Drawable myImage = res.getDrawable(R.drawable.background2);		
		ActionBar actionBar = this.getActionBar();
		actionBar.setBackgroundDrawable(myImage);
		actionBar.setDisplayUseLogoEnabled(true);
		actionBar.setDisplayShowTitleEnabled(false);
		// TODO Put your code here
		gridviewSubTipos = (GridView)findViewById(R.id.grid_tipo_evento);
		db = new BD_SQLite(this);//se obtiene la referencia a la abse de datos
		/*tsb = db.getSubtipos(idTipo);
		
		if (tsb.size()==0) {
        	Toast.makeText(this, "No existe ninguna subtipo. Retroceder y elegir otro Tipo.", Toast.LENGTH_SHORT).show();
        	
        }else{
        	ImageAdapter_final adapter = new ImageAdapter_final(tsb, this);	
    		
    		gridviewSubTipos.setAdapter(adapter);
    		gridviewSubTipos.setOnItemClickListener(new OnItemClickListener()
    	    {
    			@Override
    			public void onItemClick(AdapterView<?> adapter, View v, int position,long id) {
    				// TODO Auto-generated method stub
    				TablaSubtipo SubTipo = (TablaSubtipo)adapter.getItemAtPosition(position);				
    				Intent intent = new Intent(RE_2_Subtipo_Evento.this,RE_3_Muestra_Eventos.class);
    		    	intent.putExtra("idSubtipo",String.valueOf(SubTipo.getIdSubTipo()));
    		    	Log.e("issubtipo", String.valueOf(SubTipo.getIdSubTipo()));
    		    	startActivity(intent);
    			}	    	
    	    });
        	
        }*/
                
        
	}
}
